package hn.cch.custom;


import org.apache.kafka.clients.producer.Callback;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CustomCallback implements Callback {

    private static final Logger logger = LoggerFactory.getLogger(CustomCallback.class);

    @Override
    public void onCompletion(RecordMetadata recordMetadata, Exception e) {
        if (recordMetadata != null){
            logger.info("offset={}, partition={}", recordMetadata.offset(), recordMetadata.partition());
        }
        if (e != null){
            logger.error(e.getMessage());
        }
    }
}
